package net.huashitong.Indicators.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import net.huashitong.Indicators.dao.AB01Dao;
import net.huashitong.Indicators.dto.StudentDTO;
import net.huashitong.Indicators.entity.AB01;
import net.huashitong.Indicators.entity.AB02;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.SQLException;

@Service
public class AB01Service extends StringPKService<AB01>{

    @Autowired
    private AB01Dao dao;


    @Override
    protected BaseDao<AB01, String> getDao() {
        return dao;
    }

    @Override
    protected void beforeSave(AB01 obj) {
        obj.setSysId(dao.getSequence("seq_ab01"));
    }

    public String getSequence(String name)
    {
        return dao.getSequence(name);
    }

    public AB01 queryStudent(String userName,String userid)
    {
        return dao.queryStudent(userName,userid);
    }

    public StudentDTO getBetting(StudentDTO dto)
    {
        return dao.getBattingInfo(dto);
    }

    /**
     * 账户余额减少一个点
     */
    public  void updateAccount()
    {
        dao.updateAccount();
    }

    /**
     *
     */
    public void updateReresue()
    {
        dao.updateRestart();
    }

    public AB01 getAAb999(String aab998)
    {
        return dao.getAAB999(aab998);
    }


    public void batchUpdateAb01(String aab997) throws SQLException {
        dao.changeStudentAcount(aab997);
    }

}
